<%-- 
    Document   : index
    Created on : Oct 3, 2011, 12:22:45 AM
    Author     : ronnevig
--%>

<%@page import="stigonacci.Stigonacci"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Stigonaci</title>
    </head>
    <body>
        
<%

 if (request.getParameter("stigonacci") == null) {
 
 %>
 
 Enter value :
 
 <form  method="post">
 
 <input type="text" name="stigonacci"/>
 <input type="submit" value="Submit" />
 
 </form>
 
 <% }
 
 else {
 
 
 try {
	
	String value = request.getParameter("stigonacci");

	out.print("Stigonacci for "+value+ " : "); 
	
	
    Stigonacci s = new Stigonacci(Integer.parseInt(value));
    Thread t = new Thread(s);
    t.start();
    t.join();
    
    out.print(s.getValue());
    
    }
    
    catch(Exception e) {
    out.print("An error occurred. Can only accept integers > 0");
    }
    
 }   
%>

       
    </body>
</html>
